Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve UT coverage for IBMPowerVS controllers #726

Merged
merged 1 commit into from
Jul 1, 2022
Merged

Improve UT coverage for IBMPowerVS controllers #726

merged 1 commit into from
Jul 1, 2022

Conversation

Amulyam24
Copy link
Contributor

What this PR does / why we need it:
Adds unit tests for PowerVS controllers.
Increases the coverage of package controllers from 2.8% to 26.1%

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

/area provider/ibmcloud

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:


@k8s-ci-robot k8s-ci-robot added the area/provider/ibmcloud Issues or PRs related to ibmcloud provider label Jun 27, 2022
@netlify
Copy link

netlify bot commented Jun 27, 2022

Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!

Name Link
🔨 Latest commit a682b30
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/62bd51ab517a1400094820ac
😎 Deploy Preview https://deploy-preview-726--kubernetes-sigs-cluster-api-ibmcloud.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 27, 2022
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 27, 2022
@Amulyam24 Amulyam24 changed the title Improve UT coverage for IBMPowerVS controllers [WIP]Improve UT coverage for IBMPowerVS controllers Jun 27, 2022
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 27, 2022
@Amulyam24
Copy link
Contributor Author

Adding changes for junit reporting on the test job.

@mkumatag
Copy link
Member

Adding changes for junit reporting on the test job.

@Amulyam24 can you submit a different PR for that? lets not club everything into one PR!

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 27, 2022
@Amulyam24
Copy link
Contributor Author

Adding changes for junit reporting on the test job.

@Amulyam24 can you submit a different PR for that? lets not club everything into one PR!

Sure, makes sense. Will move the changes to a follow up PR.

@Amulyam24 Amulyam24 changed the title [WIP]Improve UT coverage for IBMPowerVS controllers Improve UT coverage for IBMPowerVS controllers Jun 27, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 27, 2022
Copy link
Contributor

@Prajyot-Parab Prajyot-Parab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@Amulyam24 See if you can optimise code wherever possible by reusing vars (bits which are possible, to avoid duplication)

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 29, 2022
Makefile Outdated Show resolved Hide resolved
controllers/ibmpowervsmachine_controller_test.go Outdated Show resolved Hide resolved
controllers/ibmpowervsmachine_controller_test.go Outdated Show resolved Hide resolved
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/powervs/mock"
)

func TestIBMPowerVSMachineReconciler_Reconcile(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most of the test contains text like should Reconcile vs not, how do we confirm if it is really for reconciled or not?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some of the test cases, we are checking if the reconcile request is requeued but I'm not sure if there's a way to check for the actual reconciliation of the object for each case in unit tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a better way to deal with this as of now, will merge this code for now.

controllers/ibmpowervsmachine_controller_test.go Outdated Show resolved Hide resolved
controllers/ibmpowervsmachine_controller_test.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 29, 2022
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jun 30, 2022
Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 1, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Amulyam24, mkumatag

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 1, 2022
@k8s-ci-robot k8s-ci-robot merged commit e118956 into kubernetes-sigs:main Jul 1, 2022
@Amulyam24 Amulyam24 deleted the add-tests branch July 20, 2022 07:04
@Amulyam24 Amulyam24 restored the add-tests branch July 20, 2022 12:12
@Amulyam24 Amulyam24 deleted the add-tests branch July 20, 2022 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/ibmcloud Issues or PRs related to ibmcloud provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants